package com.lujianfei.productprice.ui.addProduct;

public class AddProductPresenter implements AddProductContract.Presenter {
    private AddProductContract.View view;
    private AddProductContract.Model model;

    public AddProductPresenter(AddProductContract.View view) {
        this.view = view;
        this.model = new AddProductModel();
    }

    @Override
    public void loadData() {
        ProductEntity productEntity = model.getData(view.getId(),view.getShopId());
        view.setData(productEntity);
    }

    @Override
    public void save() {
        String productName = view.getProductName();
        String productPrice = view.getProductPrice();
        model.save(productName,productPrice);
    }
}
